<template>
	<view class="box">
		
		<view class="contents bg" :style="{backgroundImage:'url(https://jdkj.chitong.cn/bbg.png)'}">
			<view class="title tp">
				<image src="../../static/img/wz.png" mode="widthFix" style="width: 622rpx;"></image>
			</view>
			<view class="shareTitle tp bg" :style="{backgroundImage:'url(/static/img/qzzs.png)'}">
				分享推荐的好友在平台下单购买成功即可获得收益奖励
			</view>
			<view class="goInvite" @click="shareReachWeiXin">
				立即邀请
			</view>
			<view class="myInvite">
				<view class="titles">
					<span class="line"></span>
					<span>我的邀请</span>
					<span class="line"></span>
				</view>
				<view class="invitePrice_num">
					<view class="priceBox" @click="goEarnings">
						<view class="price num">
							{{money}}
						</view>
						<view class="recommend wz">
							推荐收益(元)
						</view>
					</view>
				</view>
				<view class="goWithdrawal" @click="goWithdrawal">
					去提现
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getMyQrcode,
		getteamtotal,
	} from '@/api/user.js'
	export default {
		data() {
			return {
				uQRCode: '',
				money:""
			}
		},
		onLoad() {
			this.initData()
		},
		methods: {
			initData() {
				getMyQrcode().then(res => {
					console.log("邀请图片", res);
					this.uQRCode = res.img
				})
				getteamtotal().then(res=>{
					this.money = res.data.income
				})
			},
			shareReachWeiXin() {
				let self = this;
				wx.downloadFile({
					url: self.uQRCode, //分享的图片的链接
					success: (res) => {
						console.log(res);
						wx.showShareImageMenu({
							path: res.tempFilePath
						})
					}
				})
			},
			goWithdrawal(){
				uni.navigateTo({
					url:'/other/withdrawal/withdrawal'
				})
			},
			goEarnings(){
				uni.navigateTo({
					url:'/other/PromoteEarnings/PromoteEarnings'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.box {
		background-color: #f5f5f5;
		width: 750rpx;
		min-height: 100vh;
	}

	.bg {
		width: 750rpx;
		background-size: cover;
		background-repeat: no-repeat;
	}

	.contents {
		width: 750rpx;
		height: 1206rpx;
		background-color: red;
		box-sizing: border-box;
		padding: 1rpx;

		.title {
			width: 622rpx;
			height: 212rpx;
		}

		.shareTitle {
			width: 614rpx;
			height: 212rpx;
			font-family: Source Han Sans CN;
			font-weight: bold;
			font-size: 34rpx;
			color: #FB3E00;
			text-align: center;
			line-height: 70rpx;
			box-sizing: border-box;
			padding: 40rpx 20rpx;

		}

	}

	.tp {
		margin: 20rpx auto;
	}

	.goInvite {
		width: 610rpx;
		height: 80rpx;
		background: #FFCC00;
		box-shadow: 0rpx 8rpx 18rpx 2rpx rgba(232, 76, 0, 0.6);
		border-radius: 40rpx;
		text-align: center;
		color: #fff;
		line-height: 80rpx;
		margin: 40rpx auto;
		font-size: 34rpx;
	}

	.myInvite {
		width: 610rpx;
		height: 360rpx;
		background: #FEF3E9;
		border-radius: 20rpx;
		box-sizing: border-box;
		padding: 20rpx;
		margin: 40rpx auto;

		.titles {
			display: flex;
			align-items: center;
			font-family: Source Han Sans CN;
			font-weight: 400;
			font-size: 34rpx;
			color: #333333;
			width: 340rpx;
			margin: 10rpx auto;

			.line {
				margin: 0 10rpx;
				width: 80rpx;
				height: 4rpx;
				background: #E5E5E5;
				border-radius: 2rpx;
				display: inline-block;
			}
		}

		.invitePrice_num {
			display: flex;
			align-items: center;
			justify-content: center;
			margin: 30rpx auto;

			.num {
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 34rpx;
				color: #333333;
			}

			.wz {
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 24rpx;
				color: #666666;
			}

			.priceBox {
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				align-items: center;
				width: 200rpx;
				height: 100rpx;
			}

			.numBox {
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				align-items: center;
				width: 200rpx;
				height: 100rpx;
			}
		}

		.goWithdrawal {
			width: 350rpx;
			height: 70rpx;
			background: #FF4625;
			box-shadow: 0rpx 5rpx 9rpx 1rpx rgba(255, 68, 35, 0.3);
			border-radius: 35rpx;
			text-align: center;
			font-size: 28rpx;
			color: #fff;
			line-height: 70rpx;
			margin: 30rpx auto;
		}
	}
</style>